package cn.tedu.lbs.marketing.web.rpc;

import cn.tedu.lbs.marketing.api.MarketingApi;
import cn.tedu.lbs.marketing.web.service.ActivityService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//rpc入口 MarketingApi接口实现
@DubboService
@Component
@Slf4j
public class MarketingApiImpl implements MarketingApi {
    @Autowired
    private ActivityService activityService;
    @Override
    public boolean activityIsVisible(Integer userId, Integer activityId) {
        //准备一个返回值 初始化true
        boolean result=true;
        try{
            result=activityService.isTargetConsumer(userId,activityId);
        }catch (Exception e){
            log.error("远程调用判断活动可见失败",e);
        }
        return result;
    }
}
